<%@ page contentType="text/html;charset=UTF-8" trimDirectiveWhitespaces="true"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<c:set var="extLibs" value="grid"/>
<sys:header title="疗休养申请管理" extLibs="${extLibs}" />
<div class="portlet box ${boxStyleColor}">
	<div class="portlet-title">
		<div class="caption"><i class="icon-bar-chart"></i> 教职工疗休养人员报名表</div>
		<div class="actions">
			<a href="#" class="btn btn-default btn-sm" id="btnSearch" title="查询"><i class="fa fa-search"></i> 查询</a>
			<a href="#" class="btn btn-default btn-sm" id="btnExport" title="导出"><i class="fa fa-external-link"></i>导出</a>
		</div>
	</div>
	<div class="portlet-body list">
		<form:form id="searchForm" modelAttribute="retinue" action="${ctx}/rst/retinue/listRetinueData" method="post" class="breadcrumb form-inline hide"
				data-page-no="${page.pageNo}" data-page-size="${page.pageSize}" data-order-by="${page.orderBy}">
			<div class="form-group">
				<label class="control-label">姓名：</label>
				<div class="input-inline">
					<form:input path="name" htmlEscape="false" maxlength="4" class="form-control input-sm width-160"/>
				</div>
			</div>
			<div class="form-group">
				<label class="control-label">身份证：</label>
				<div class="input-inline">
					<form:input path="idNo" htmlEscape="false" maxlength="4" class="form-control input-sm width-160"/>
				</div>
			</div>
			<div class="form-group">
				<label class="control-label">分工会：</label>
				<div class="input-inline width-160" >
					<sys:treeselect id="office" name="officeCode" value="${retinue.officeCode}" labelName="officeName" labelValue="${retinue.officeName}"
						title="分工会" url="/sys/office/treeData?type=2" controlSize="sm" allowClear="true" notAllowSelectParent="false"/>
				</div>
			</div>
			
			<div class="form-group" style="margin-left:10px;"> 
				<input class="btn btn-primary btn-sm" type="submit" value="查询"/>&nbsp;
				<input class="btn default btn-sm" type="reset" value="重置"/>
			</div>
		</form:form>
		<table id="dataGrid"></table>
	    <div id="dataGridPage"></div>
	</div>
</div>
<sys:footer extLibs="${extLibs}" />
<script type="text/javascript">
	// 初始化DataGrid对象
	$("#dataGrid").dataGrid({
		
		searchForm: $("#searchForm"), // 数据来源表单
		tabPageId: '${param.tabPageId}',// 当前页签编号
		
		// 设置数据表格列
		columnModel: [
			{header:'姓名', name:'name', index:'a.name', width:200, align:"left", frozen:true},
			{header:'申请人', name:'applyName', index:'b.apply_name', width:200, align:"left", frozen:true},
			{header:'性别', name:'sex', index:'a.sex', width:80, align:"center", formatter: function(val, obj, row, act){
					return getDictLabel(${fns:getDictListJson('sex')}, val, '', true);
				}},
			{header:'分工会', name:'officeName', index:'a.office_name', width:200, align:"left"},
			{header:'身份证号', name:'idNo', index:'a.id_no', width:150, align:"left"},
			{header:'联系电话', name:'phone', index:'a.phone', width:120, align:"left"},
			{header:'出发校区', name:'campus', index:'a.campus', width:100, align:"left", formatter: function(val, obj, row, act){
					return getDictLabel(${fns:getDictListJson('campus')}, val, '', true);
				}},
			{header:'线路', name:'lineName', index:'a.current_year', width:120, align:"left"},
			{header:'申请时间', name:'createDate', index:'a.createDate', width:120, align:"left"}
		],
		ajaxSuccess: function(data){ // 加载成功后执行方法
			
		}
	});



	//数据导出
	$("#btnExport").click(function(){
		top.$.jBox.confirm("确认要导出数据吗？","系统提示",function(v,h,f){
			if(v=="ok"){
				ajaxDownload('${ctx}/rst/restApply/retinueExport',$("#searchForm").serialize());
			}
		},{buttonsFocus:1});
		top.$('.jbox-body .jbox-icon').css('top','55px');
	});

	/**
	 * Ajax 文件下载
	 */
	function ajaxDownload(url, data, method) {
		// 获取url和data
		if (url && data) {
			// data 是 string 或者 array/object
			data = typeof data == 'string' ? data : jQuery.param(data);
			// 把参数组装成 form的 input
			var inputs = '';
			$.each(data.split('&'), function() {
				var pair = this.split('=');
				inputs += '<input type="hidden" name="' + pair[0] + '" value="'
						+ pair[1] + '" />';
			});
			// request发送请求
			$('<form action="' + url + '" method="' + (method || 'post')
					+ '" >' + inputs + '</form>').appendTo('body').submit().remove();
		}
	}
</script>